/*
 *  native.h
 *  joosVM
 *
 *  Created by Smári Waage on 7.9.2009.
 *  Copyright 2009 smari.org. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. *
 */

#ifndef nativemethods___ 
#define nativemethods___ 

//#include "classloader.h"
#include "classloader.h"

typedef union { Pointer *pointer; void (*func)(TaggedArray*, Stack*); } native_func;
class NativeMethods {
public:
	//static void* lookupNativeMethod();
	static void callNativeMethod(JMethod* nMethod, TaggedArray* locals, Stack* s);
	static native_func linkMethod(JMethod* nMethod);
	
	//PrintStream
	static void str_println(TaggedArray* locals, Stack* s);
	static void str_print(TaggedArray* locals, Stack* s);
	static void int_println(TaggedArray* locals, Stack* s);
	static void int_print(TaggedArray* locals, Stack* s);
	static void dbl_println(TaggedArray* locals, Stack* s);
	static void dbl_print(TaggedArray* locals, Stack* s);
	
	
	//static void _pow(TaggedArray* locals, Stack* s);
	//java.lang.System
	static void currentTimeMillis(TaggedArray* locals, Stack* s);
	
	//java.io.list
	static void list(TaggedArray* locals, Stack* s);
	
	//java.lang.String
	static void substring(TaggedArray* locals, Stack* s);
	static void length(TaggedArray* locals, Stack* s);
	static void equals(TaggedArray* locals, Stack* s);
	static void concat(TaggedArray* locals, Stack* s);
	
	//java.lang.Class
	static void forName(TaggedArray* locals, Stack* s);
	static void getMethod(TaggedArray* locals, Stack* s);
	
	//java.lang.reflect.Method
	static void invoke(TaggedArray* locals, Stack* s);
	
	//java.lang.Integer
	static void parseInt(TaggedArray* locals, Stack* s);
	
	
	//Special 
	static void getRandomInt(TaggedArray* locals, Stack* s);
};


#endif
